package com.bootredis.bootredis.service.serviceimpl;



import com.bootredis.bootredis.mapper.EmpMapper;
import com.bootredis.bootredis.service.EmpService;
import com.bootredis.bootredis.vo.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;

@Service("serviceimpl")
public class EmpServiceImpl implements EmpService {
    @Autowired
    EmpMapper empMapper;

    @Autowired
    StringRedisTemplate stringRedisTemplate;
    @Autowired
    RedisTemplate redisTemplate;


    @Cacheable(cacheNames = "wcnb",key = "111")
    @Override
    public List<Emp> findAll() {
        List<Emp>   list = empMapper.findAll();
        Emp empq = new Emp();
        String aaa = "";
        for (Emp alll: list){
            aaa+= alll.getEname();
            empq.setEname(alll.getEname());
            empq.setComm(alll.getComm());
            empq.setCount(alll.getCount());
            empq.setDeptno(alll.getDeptno());
            empq.setEmpno(alll.getEmpno());
        }
//        redisTemplate.opsForValue().set("user1", empq);
//        stringRedisTemplate.opsForValue().set("aaa","11111966565");
        return list;
    }
}
